#include <sysbios/nano/Kernel.h>
#include <xdc/runtime/System.h>

#include <Drv.h>

#include "package/internal/App.xdc.h"

/*
 *  ======== main ========
 */
Int App_main( Int argc, Char* argv[] )
{
    volatile Int idle = 1;

    Kernel_start();
    Drv_doIO(module->count, &module->done);

    while (idle) ;

    return 0;
}

/*
 *  ======== reactor ========
 */
Void App_reactor( Ptr me, Kernel_Signal signal )
{
    System_printf("IO done\n");

    if (--module->count < 0) {
        System_exit(0);
    }
    else {
        Drv_doIO(module->count, &module->done);
    }
}
